import { createApp} from 'vue'
import "bootstrap/dist/css/bootstrap.css"
import router from './router/router1'
import Emitter from 'tiny-emitter'
import axios from './router/axios'
import ElementPlus from 'element-plus' //引入 element-plus 库
import VForm3 from 'vform3-builds' //引入 VForm3 库
import 'element-plus/dist/index.css' //引入 element-plus 样import VForm3 from 'vform3-builds' //引入 VForm3 库
import 'vform3-builds/dist/designer.style.css' //引入VForm3 样式
import App from './App16.vue'
import i18n from './locals'


var app = createApp(App)
var permission = ["cldk_user_query"];
app.config.globalProperties.$permiss = permission;
//路由
 app.use(router);
 window.http=axios;
//挂载事件总线
app.config.globalProperties.$bus = new Emitter();
//element-plus
app.use(ElementPlus);
app.use(i18n);
app.use(VForm3); //全局注册 VForm3(同时注册了 v-form-designe、v-form-render 等组件)
app.directive("hasPermission",{
    mounted(el,binding){
        const value = binding.value;
        var flag = permission.some(function(item){
            return item.indexOf(value) !== -1
        });
        if(flag){
            // if(el.parentNode){
            //     el.parentNode.removeChiled(el);
            // }
            el.style.display = "none"
        }
    },
    updated(el,binding){
        const value = binding.value;
        var flag = permission.some(function(item){
            return item.indexOf(value) !== -1
        });
        if(!flag){
            el.style.display = "none"
        }else{
            el.style.display = ""
        }
    }
});
app.mount('#app')
